//
//  TitleLableViewController.m
//  指纹识别
//
//  Created by lzy on 2018/4/20.
//  Copyright © 2018年 lzy. All rights reserved.
//

#import "TitleLableViewController.h"

@interface TitleLableViewController ()

@end

@implementation TitleLableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"行间距";
    
    //方式一 attributedString
    
    UILabel * lable1 = ({
        UILabel * lable = [[UILabel alloc]initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, 150)];
        lable.text = @"方式一 attributedString 设置行间距 汉体书写信息技术标准相容档案下载使用界面简单 支援服务升级资讯专业制作创意空间快速无线上网㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩AaBbCc ＡａＢｂＣｃ";
        lable.numberOfLines = 0;
        [self.view addSubview:lable];
        
        
        lable;
    });
    
    lable1.textColor = [UIColor blueColor];
    
    NSMutableAttributedString *attributedString =
    [[NSMutableAttributedString alloc] initWithString:lable1.text];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:10];
    
    //调整行间距
    [attributedString addAttribute:NSParagraphStyleAttributeName
                             value:paragraphStyle
                             range:NSMakeRange(0, [lable1.text length])];
    lable1.attributedText = attributedString;
    
    
    //方式二
    
    UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, 250, self.view.bounds.size.width, 150)];
    label.numberOfLines = 0;
    label.textColor = [UIColor redColor];
    [label setValue:@(30) forKey:@"lineSpacing"];
    label.text = @"方式二 lineSpacing 属性控制 汉体书写信息技术标准相容档案下载使用界面简单 支援服务升级资讯专业制作创意空间快速无线上网㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩AaBbCc ＡａＢｂＣｃ";
    [self.view addSubview:label];
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
